package org.tankwar.model;

import org.tankwar.util.GlobalUtil;
import org.tankwar.util.ImageUtil;

import java.awt.*;

public class Blood extends GameProp{
    public Blood() {
        this.width = 40;
        this.height = 40;
        this.x = 20;
        this.y = 30;
        this.bloodImage = GlobalUtil.tk.getImage(Blood.class.getResource(ImageUtil.BLOOD_IMAGE_URL));
        this.position = new int[][]{ { 155, 196 }, { 500, 80 }, { 80, 340 },
                { 99, 199 }, { 345, 456 }, { 123, 321 }, { 258, 413 } };
    }

    @Override
    public void draw(Graphics g) {
        if (GlobalUtil.rand.nextInt(100) > 98) { // 有一定概率画不画血包  1%的概率
            this.live = true;
            move();
        }
        if (!live)
            return;
        g.drawImage(bloodImage, x, y, null);
    }
}
